package com.totoro.mapstruct.mapstruct_result_type.mapper;

import com.totoro.mapstruct.mapstruct_result_type.bean.Apple;
import com.totoro.mapstruct.mapstruct_result_type.bean.Banana;
import com.totoro.mapstruct.mapstruct_result_type.bean.Fruit;
import com.totoro.mapstruct.mapstruct_result_type.bean.FruitDto;
import com.totoro.mapstruct.mapstruct_result_type.factory.FruitFactory;
import org.mapstruct.BeanMapping;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;

/**
 * Created by Niki on 2018/9/28 17:39
 */
@Mapper(uses = FruitFactory.class)
public interface FruitMapper {
    @BeanMapping(resultType = Apple.class)
//    @Mapping(target = "type", defaultValue = "红富士")
    Fruit dto2Apple(FruitDto dto);

    @BeanMapping(resultType = Banana.class)
//    @Mapping(target = "type", defaultValue = "小黄人")
    Fruit dto2Banana(FruitDto dto);
}
